package com.timesheet.server.core.models;

import java.io.Serializable;
import java.util.Collection;

import javax.persistence.CascadeType;
import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.GeneratedValue;
import javax.persistence.GenerationType;
import javax.persistence.Id;
import javax.persistence.JoinColumn;
import javax.persistence.JoinTable;
import javax.persistence.ManyToMany;
import javax.persistence.OneToMany;
import javax.persistence.OneToOne;
import javax.persistence.Table;

/**
 * 
 * @author binu
 */
@Entity
@Table(name="EMPLOYEE")
public class Employee implements Serializable {
	/**
	 * 
	 */
	private static final long serialVersionUID = 1L;
	@Id
	@GeneratedValue(strategy = GenerationType.AUTO)
	@Column(name = "EMP_ID")
	private String employeeId;
	// @Column(name="emp_name")
	private String name;

	
	
	@ManyToMany(cascade = CascadeType.ALL)
	@JoinTable(name = "EMP_PROJECT_ASSIGNMENT", joinColumns = { @JoinColumn(name = "EMP_ID", referencedColumnName = "EMP_ID") }, inverseJoinColumns = { @JoinColumn(name = "PROJ_ID", referencedColumnName = "PROJ_ID") })
	private Collection<Project> projects;

	

	@OneToMany(cascade = CascadeType.ALL)
	@JoinTable(name = "EMP_TASK_ASSIGNMENT", joinColumns = { @JoinColumn(name = "EMP_ID", referencedColumnName = "EMP_ID") }, inverseJoinColumns = { @JoinColumn(name = "TASK_ID", referencedColumnName = "TASK_ID") })
	private Collection<Task> tasks;

	public Collection<Task> getTasks() {
		return tasks;
	}

	public void setTasks(Collection<Task> tasks) {
		this.tasks = tasks;
	}

	public Collection<Project> getProjects() {
		return projects;
	}

	public void setProjects(Collection<Project> projects) {
		this.projects = projects;
	}

	public String getEmployeeId() {
		return employeeId;
	}

	public void setEmployeeId(String employeeId) {
		this.employeeId = employeeId;
	}

	public String getName() {
		return name;
	}

	public void setName(String name) {
		this.name = name;
	}

	

	

}
